package ai.evaluation;

import java.util.Hashtable;

import structure.Board;
import utils.Param;

public abstract class Evaluator {
	private static final Hashtable<Long,Float> cache = new Hashtable<Long,Float>();
	
	public float evaluate(Board board, byte color){
		if(Param.WITH_CACHE){
			Float score = cache.get(board.getHash());
			if(score == null){
				score = fe(board,color);
				cache.put(board.getHash(), score);
			}
			return score;
		}
		
		return fe(board,color);
	}
	
	protected abstract float fe(Board board, byte color);
	public abstract String toString();
}
